All Questions
7 questions
0votes
3answers
3kviews
How to handle a new method in the interface that is not applicable for all classes?
I am faced with an interesting OOD problem: I have an interface with 3 methods: interface TestInterface { String action1(); String action2(); String action3(); } and 3 classes that ...
1vote
1answer
76views
Modeling objects that behave in different ways so that they can be stored in a collection?
Suppose I have a Player class with an Inventory: public abstract class Player { private final List<GameObject> gameObjects; public Player(){ this.gameObjects = new ArrayList&...
3votes
1answer
4kviews
Should an abstract class implement an interface, as opposed to defining its own abstract methods?
I'm defining a class structure for persisting to our cassandra database, and I'm unsure about using a combination of an abstract class and an interface. I have two concrete classes, one for persisting ...
6votes
4answers
11kviews
Are empty interfaces (but not marker interfaces) a bad programming practice?
I'm designing an architecture in which I have: public interface IObjectReader{ public Object read(); } public class ConcreteObjectReader implements IObjectReader{ @Override public ...
-1votes
3answers
2kviews
Can I say Interface is a set of general behavior? [duplicate]
I'm new to OOP. Can I say Interface is a set of general behavior that may be have and act uniquely by a set of objects that have in common? And Abstract class has similarity with Interface but it have ...
1vote
1answer
2kviews
How to generalize a classes that has identical function plus some additional function
I have some designing problems with my project. To illustrate my problem, I'll use the following two classes from my project. public class RAM_UserManagement{ private Map<int,User> userList; ...
42votes
9answers
4kviews
Programming for future use of interfaces
I have a colleague sitting next to me who designed an interface like this: public interface IEventGetter { public List<FooType> getFooList(String fooName, Date start, Date end) ...